<include file="Public:header" />
<!--文章管理-->
<div class="pad_lr_10">

    <form name="searchform" method="get" >
        <table width="100%" cellspacing="0" class="search_form">
            <tbody>
                <tr>
                    <td>
                        <div class="explain_col">
                            <input type="hidden" name="m" value="Admin" />
                            <input type="hidden" name="c" value="Article" />
                            <input type="hidden" name="a" value="index" />
                            <input type="hidden" name="menuid" value="{$menuid}" />
                            <input name="keyword" type="text" class="input-text" size="15" value="{$Think.get.keyword}" />
                            <select name="searchtype">
                                <option value="id" <eq name="searchtype" value='id'>selected="selected"</eq>>{:L('article_id')}</option>
                                <option value="title" <eq  name="search.searchtype" value='title'>selected="selected"</eq>>{:L('article_title')}</option>
                            </select>
                            <select id="site" name="site" onchange="select_cat(this.value)">
                                <option value="0">{:L('chose_site')}</option>
                                <volist name="site_list" id="vo">
                                    <option value="{$vo.site_id}" <if condition="$vo['site_id'] eq $search['site']">selected="selected"</if>>{$vo.site_name}</option>
                                </volist>
                            </select>
                            <select id="cate" name="cate">
                                <option value="0">{:L('chose_cate')}</option>
                            </select>
                            <select name="thumb">
                                <option value="">-{:L('all')}-</option>
                                <option value="1" <if condition="$search.thumb eq '1'">selected="selected"</if>>{:L('is_thumb')}</option>
                            </select>
                            <select name="sort">
                                <option value="asc" <if condition="$search.sort =='asc'">selected="selected"</if>>{:L('order_by_asc')}</option>
                                <option value="desc" <if condition="$search.sort =='desc'">selected="selected"</if>>{:L('order_by_desc')}</option>
                            </select>
                            <select name="listRows">
                                <option value="20" <if condition="$search.listRows ==20">selected="selected"</if>>20{:L('listRows')}</option>
                                <option value="50" <if condition="$search.listRows ==50">selected="selected"</if>>50{:L('listRows')}</option>
                                <option value="100" <if condition="$search.listRows ==100">selected="selected"</if>>100{:L('listRows')}</option>
                            </select>
                            <input type="submit" name="search" class="btn" value="{:L('search')}" />
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <div class="textbox">
        <div class="picbox" role="table">
            <div class="J_tablelist table_list" data-acturi="{:U('Article/ajax_edit')}">
                <table width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th width="40"><input type="checkbox" name="checkall" class="J_checkall"></th>
                            <th width="40">ID</th>
                            <th width="100">{:L('site')}</th>
                            <th width="100">{:L('cate')}</th>
                            <th>{:L('title')}</th>
                            <th width="80">{:L('status')}</th>
                            <th width="100">{:L('addtime')}</th>
                            <th width=100>{:L('operations_manage')}</th>
                        </tr>
                    </thead>
                    <tbody>
                    <volist name="list" id="val" >
                        <tr>
                            <td align="center"><input type="checkbox" class="J_checkitem" value="{$val.id}"></td>
                            <td align="center">{$val.id}</td>
                            <td align="center">{$val.site_name}</td>
                            <td align="center">{$val.cat_name}</td>
                            <td align="left">{$val.title}</td>
                            <td align="center"><if condition="$val.status eq 1">{:L('yes')}<else/>{:L('no')}</if></td>
                            <td align="center">{$val.addtime|date='Y-m-d',###}</td>
                        <td align="center">
                            <a href="{:U('Article/edit', array('id'=>$val['id'],'menuid'=>$menuid))}">{:L('edit')}</a> |
                            <a href="javascript:;" class="J_confirmurl" data-uri="{:U('Article/delete', array('id'=>$val['id']))}" data-msg="{:sprintf(L('confirm_delete_one'),$val['title'])}">{:L('delete')}</a>
                        </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="btn_wrap_fixed">
        <label class="select_all mr10"><input type="checkbox" name="checkall" class="J_checkall">{:L('select_all')}/{:L('cancel')}</label>
        <input type="button" class="btn" data-tdtype="batch_action" data-acttype="ajax" data-uri="{:U('Article/delete')}" data-name="id" data-msg="{:L('confirm_delete')}" value="{:L('delete')}" />
        <div id="pages">{$page}</div>
    </div>
</div>
<script>
    $(function(){
        var site_id = $("#site").val();
        var cat_id = "{$search.cate}";
        if (site_id) {
            select_cat(site_id, cat_id);
        }
    });
    function select_cat(site_id,cat_id) {
        $.ajax({
           type: "POST",
           url: "{:U('Article/getCate')}",
           data: "site_id="+site_id+"&cat_id="+cat_id,
           success: function(result){
               str = "<option value='0'>{:L('chose_cate')}</option>";
                $('#cate').empty().append(str+result.data);
           }
        });
    }
</script>
<include file="Public:footer" />
</body>
</html>